package main

import (
	"fmt"
)

type Usb interface {
	Stop()
	Start()
}

type Phone struct{}

type PC struct{}

func (p Phone) Stop() {
	fmt.Println("手机停止")
}

func (p Phone) Start()  {
	fmt.Println("手机开始")
}

func (p Phone) Call()  {
	fmt.Println("手机电话")
}

func (p PC) Stop()  {
	fmt.Println("电脑停止")
}

func (p PC) Start()  {
	fmt.Println("电脑开始")
}

//体现多态
func Working(usb Usb)  {
	usb.Start()
	usb.Stop()
	if phone,ok := usb.(Phone); ok {
		phone.Call()
	}
}

func main()  {
	p := Phone{}
	Working(p)
	pc := PC{}
	Working(pc)
}

